{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 24,
   "outputs": [],
   "source": [
    "import math\n",
    "\n",
    "class Point:\n",
    "    def __init__(self, x, y):\n",
    "        self.x = x\n",
    "        self.y = y\n",
    "\n",
    "    def __str__(self):\n",
    "        return f\"Point({self.x}, {self.y})\"\n",
    "\n",
    "    def __eq__(self, other):\n",
    "        return self.x == other.x and self.y == other.y\n",
    "\n",
    "    def getDistance(self, other):\n",
    "        w = self.x - other.x\n",
    "        h = self.y - other.y\n",
    "\n",
    "        return math.sqrt(w**2 + h**2)\n",
    "\n",
    "class Circle:\n",
    "    def __init__(self, o, r):\n",
    "        self.o = o\n",
    "        self.r = r\n",
    "\n",
    "    def __str__(self):\n",
    "        return f\"Circle({self.o}, {self.r})\"\n",
    "\n",
    "    def getArea(self):\n",
    "        return self.r ** 2 * math.pi\n",
    "\n",
    "    def getPerimeter(self):\n",
    "        return self.r * 2 * math.pi"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n"
     ]
    }
   ],
   "source": [
    "p1 = Point(2, 3)\n",
    "p2 = Point(2, 3)\n",
    "\n",
    "print(p1 == p2)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Circle(Point(2, 3), 7)\n",
      "153.93804002589985\n",
      "43.982297150257104\n",
      "Circle(Hello, 11)\n",
      "380.132711084365\n",
      "69.11503837897544\n"
     ]
    }
   ],
   "source": [
    "p1 = Point(2, 3)\n",
    "c1 = Circle(p1, 7)\n",
    "print(c1)\n",
    "print(c1.getArea())\n",
    "print(c1.getPerimeter())\n",
    "\n",
    "c2 = Circle(\"Hello\", 11)\n",
    "print(c2)\n",
    "print(c2.getArea())\n",
    "print(c2.getPerimeter())"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Point(2, 3) <class '__main__.Point'>\n",
      "Point(5, 7) <class '__main__.Point'>\n",
      "5.0\n"
     ]
    }
   ],
   "source": [
    "p1 = Point(2, 3)\n",
    "p2 = Point(5, 7)\n",
    "print(p1, type(p1))\n",
    "print(p2, type(p2))\n",
    "print(p1.getDistance(p2))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}